package com.zx.core.enums;


import lombok.Getter;

/**
 * <p>
 * description: 启用状态控制枚举定义 <br>
 * create: 2024-09-08 17:47
 * </p>
 *
 * @author zhou  xun
 */
@Getter
public enum StatusEnum {
    ENABLE(1, "启用", true),
    DISABLE(0, "禁用", false);

    /**
     * code
     */
    private final Integer code;
    /**
     * 说明
     */
    private final String desc;
    /**
     * 布尔值
     */
    private final boolean boolValue;

    StatusEnum(Integer code, String desc, boolean boolValue) {
        this.code = code;
        this.desc = desc;
        this.boolValue = boolValue;
    }

    public static StatusEnum getEnumByDesc(String desc) {
        for (StatusEnum value : values()) {
            if (value.desc.equals(desc)) {
                return value;
            }
        }
        return null;
    }

    public static StatusEnum getEnumByCode(Integer code) {
        for (StatusEnum value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }


}
